<div id="{{ id }}" class="dd dd-draghandle">

{% if title_display is empty %}
{% set title_display = false %}
{% endif %}

	{% if title == null AND title_display == true %}
	<h4 class="header smaller lighter grey">{{ title }}</h4>
	<div class="space-8"></div>
	{% endif %}
	{%- macro hierarchical_list(data,hierarchy) %}
	<ol class="dd-list">
		{%- for key, value in hierarchy %} {% if key != value %}
		<li data-id="{{ key }}" class="dd-item dd2-item">
			<div class="dd-handle dd2-handle">
				<i class="normal-fa fa-move bigger-130"></i> <i
					class="drag-fa fa-move pink bigger-125"></i>
			</div>
			<div class="dd2-content">
			<?php if (!empty($data[$key]['link'])){ ?>
				<a href="{{ data[key]['link'] }}">{{ data[key]['name'] }}</a>
			<?php }else{ ?>
				{{ data[key]['name'] }}
			<?php } ?>
				{%- for link in data[key]['nav'] %} <a
					class="pull-right ajax-load-link" hrefbox=".main-content"
					href="{{ link['href'] }}">{{ link['name'] }}&nbsp;|&nbsp;</a>{%- endfor %}
			</div> {{ hierarchical_list(data,value) }}
		</li> {% else %}
		<li data-id="{{ key }}" class="dd-item dd2-item">
			<div class="dd-handle dd2-handle">
				<i class="normal-fa fa-move bigger-130"></i> <i
					class="drag-fa fa-move pink bigger-125"></i>
			</div>
			<div class="dd2-content">
			<?php if (!empty($data[$key]['link'])){ ?>
				<a href="{{ data[key]['link'] }}">{{ data[key]['name'] }}</a>
			<?php }else{ ?>
				{{ data[key]['name'] }}
			<?php } ?>
			 {% for link in data[key]['nav'] %} <a
					class="pull-right ajax-load-link" hrefbox=".main-content"
					href="{{ link['href'] }}">{{ link['name'] }}&nbsp;|&nbsp;</a> {% endfor %}
			</div>
		</li> {% endif %} {%- endfor %}
	</ol>
	{%- endmacro %}

	<?php if (is_array($data) && is_array($hierarchy)) { ?>
	{{ hierarchical_list(data,hierarchy) }}
	<button type="submit" class="btn btn-success btn-block">保存排序</button>
	<?php }else { ?>
	程序提供的数据合法或为空。
	<?php } ?></div>